package com.java.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

/**
 * @Author admin
 * @Date 2021/5/7 17:24
 * @Version 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        list.add(new Student(15,"cs",123));
        list.add(new Student(19,"cs1",58));
        list.add(new Student(16,"cs2",144));
        System.out.println(list);
        list.forEach(student -> {
            if ("cs".equals(student.getName())){
                System.out.println("年龄："+student.getAge());
                System.out.println("id："+student.getId());
            }
        });
    }
    private static class  Student{
        int age;
        String name;
        Integer id;

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public Student(int age, String name, Integer id) {
            this.age = age;
            this.name = name;
            this.id = id;
        }

        public Student() {
        }

        @Override
        public String toString() {
            return "Student{" +
                    "age=" + age +
                    ", name='" + name + '\'' +
                    ", id=" + id +
                    '}';
        }
    }
}
